package reggie;


import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.plugin.Interceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import reggie.config.WebMvcConfig;

import javax.management.MXBean;
import java.util.Arrays;

@Slf4j
@SpringBootApplication
//扫描拦截器
@ServletComponentScan
//事物注解的支持
@EnableTransactionManagement
@Import(WebMvcConfig.class)
public class ReggieApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(ReggieApplication.class, args);
        log.info("项目启动成功!");
        //String[] beanNamesForType = application.getBeanNamesForType(WebMvcConfig.class);
        //System.out.println(Arrays.toString(beanNamesForType));

    }

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        //分页拦截器
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatisPlusInterceptor;
    }


}
